<?php 
if (!$this->product_info['vote']){
	echo $this->formHidden("vote-value",3);
}else{
	echo $this->formHidden("vote-value",round($this->product_info['vote_value']/$this->product_info['vote']));
}
	echo $this->formHidden("product_id",$this->product_info['id']);
?>
<div class="product-detail-info">
	<div class="icon-warper">
		<img ismap src="<?php echo $this->product_info["icon"]?>" title="<?php echo $this->product_info["name"]?> icon" alt="<?php echo $this->product_info["name"]?> icon">
	</div>
	<div class="info-warper">
		<span class="title"><?php echo $this->product_info["name"]?></span>
		<span class="developer"><?php echo $this->product_info["developer"]?></span>
		<div class="vote">
			<span id = 'vote_choice'>
			</span>
			(<?php echo $this->product_info["vote"]?> đánh giá)
		</div>
		<span class="detail"><span>Phiên bản:</span><span><?php echo $this->product_info["version"]?></span></span>
		<span class="detail"><span>Dung lượng:</span><span><?php echo $this->product_info["size"]?></span></span>
		<span class="detail"><span>Cập nhật:</span><span><?php $update_time = new Zend_Date($this->product_info["update"],"yyyy-MM-dd HH:mm:ss"); echo $update_time->toString("yyyy-MM-dd")?></span></span>
		<span class="detail"><span>Yêu cầu:</span><span><?php echo $this->product_info["requreiment"]?></span></span>
	</div>
	<div class="download">
		<div id="link-warper">
			<?php $download_link_list = Zend_Json::decode($this->product_info['download_link'])?>
			<?php if ($download_link_list):?>
				<?php foreach ($download_link_list as $k	=> $value) :?>
					<div><a href="/product/download/id/<?php echo $this->arrParam['id']?>/key/<?php echo $k?>">Link tải <?php echo $k + 1?></a></div>
				<?php endforeach;?>
			<?php endif;?>
		</div>
		<hr/>
		<ul>
			<li><img alt="" src="/images/icons/icon-luot-xem.png" style="margin-bottom: 5px;"><span> <?php echo $this->product_info["view"]?></span></li>
			<li style="text-align: center;"><img alt="" src="/images/icons/icon-coment.png"><span><?php echo $this->product_info["comment"]?></span></li>
			<li style="text-align: right;"><img alt="" src="/images/icons/icon-luot-tai.png"><span><?php echo $this->product_info["download"]?></span></li>
		</ul>
	</div>
</div>
<div class="share-warper">
	<div style="float: right;">
		<div class="g-plus" data-action="share" data-annotation="none"></div>
		<a href="https://twitter.com/share" class="twitter-share-button" data-url="<?php echo HOMEPAGE . "/product/detail/id/" . $this->arrParam["id"]?>" data-dnt="false" data-count="none" >Tweet</a>
		<div class="fb-share-button" data-href="<?php echo HOMEPAGE . "/product/detail/id/" . $this->arrParam["id"]?>" data-type="button"></div>
	</div>
	<a id="report-error" href="/product/report-error/id/<?php echo $this->arrParam['id']?>">Báo lỗi link tải</a>
</div>
<div class="swiper-container">
	<div class="swiper-wrapper">
		<?php $ingame_image_list = Zend_Json::decode($this->product_info['ingame_image'])?>
		<?php if ($ingame_image_list):?>
			<?php foreach ($ingame_image_list as $k	=> $value) :?>
				<div class="swiper-slide"> 
					<img class="picture"  ismap src="<?php echo $value?>">
				</div>
			<?php endforeach;?>
		<?php endif;?>
	<!--Etc..-->
	</div>
</div>
<div class="swiper-scrollbar"></div> 
<div class="maincontent">
	<div id="product-content">
		<h2>Đánh giá</h2>
		<div id = "product-content-warper">
			<?php echo $this->product_info["content"]?>
		</div>
		<img alt="" src="/images/icons/button-so-xuong.png" id="show-product-content" style="display: none;float: right;">
		<img alt="" src="/images/icons/button-so-len.png" id="hidden-product-content" style="display: none;float: right;">
	</div>
	<div class="share-warper">
		<div style="float: right;">
			<div class="g-plus" data-action="share" data-annotation="none"></div>
			<a href="https://twitter.com/share" class="twitter-share-button" data-url="<?php echo HOMEPAGE . "/product/detail/id/" . $this->arrParam["id"]?>" data-dnt="false" data-count="none" >Tweet</a>
			<div class="fb-share-button" data-href="<?php echo HOMEPAGE . "/product/detail/id/" . $this->arrParam["id"]?>" data-type="button"></div>
		</div>
	</div>
	<div style="width: 100%;background: #fff">
		<h3 style="padding: 10px 0 10px 5px">Bình luận</h3>
		<div class="fb-comments" data-href="<?php echo HOMEPAGE . "/product/detail/id/" . $this->arrParam["id"]?>" data-numposts="5" data-colorscheme="light" width="460"></div>
	</div>
	<h2 style="padding-top: 14px;color: #606060;">Gợi ý dành riêng cho bạn</h2>
	<?php if ($this->relative_product_list) : ?>
		<div id="relative-product">
			<div class="swiper-wrapper" style="height: 286px">
				<?php foreach ($this->relative_product_list as $product) : ?>
					<div class="swiper-slide"> 
						<div class="list-product" style="width: 100%">
							<div class="icon-warper">
								<a href="/product/detail/id/<?php echo $product["id"]?>">
									<img src="<?php echo $product["icon"]?>" title="<?php echo $product["name"]?>" alt="<?php echo $product["name"]?>">
								</a>
							</div>
							<div class="download">
								<ul>
									<li><img alt="" src="/images/icons/icon-luot-xem.png" style="margin-bottom: 5px;padding: 0"><span> <?php echo $product["view"]?></span></li>
									<li><img alt="" src="/images/icons/icon-coment.png" style="margin-bottom: 5px;padding: 0"> <?php echo $product["comment"]?></li>
									<li><img alt="" src="/images/icons/icon-luot-tai.png" style="margin-bottom: 5px;padding: 0"> <?php echo $product["download"]?></li>
								</ul>
							</div>
							<div class="clearfix"></div>
							<div class="info-warper">
								<a href="/product/detail/id/1">
									<span class="title"><?php echo $product["name"]?></span>
								</a>
							</div>
						</div>
					</div>
				<?php endforeach;?>
			</div>
		</div>
	<?php endif;?>
</div>
<script type="text/javascript">
<!--
window.onload = function() {
	var swiper = new Swiper('.swiper-container', {
	    //Scrollbar:
        slidesPerView: 'auto',
	    scrollbar: {
	        container : '.swiper-scrollbar',
//	        draggable : true,
	        hide: false,
	        snapOnRelease: true,
	        preventLinks:true,
	    }
	})
	var swiper = new Swiper('#relative-product', {
	    //Scrollbar:
        slidesPerView: 2,
        height : "auto"
	})
};
var v;
$( document ).ready(function() {
	$(".picture").fancyzoom();
	var min = $('#vote-value').val();
	v = new jVote('vote_choice', {max:5,min:min,click:doStuff,labels:['1','2','3','4','5']});
	if($("#product-content-warper").height() > 200){
		$("#show-product-content").show();
		$("#product-content-warper").css({
			'max-height':'200px',
			'overflow':'hidden'
		});
		$("#product-content").css({"padding-bottom":"35px"});
	}
	$("#show-product-content").click(function(){
		$("#product-content-warper").removeAttr('style');
		$("#show-product-content").hide();
		$("#hidden-product-content").show();
	});
	$("#hidden-product-content").click(function(){
		$("#show-product-content").show();
		$("#product-content-warper").css({
			'max-height':'200px',
			'overflow':'hidden'
		});
		$("#product-content").css({"padding-bottom":"35px"});
		$("#hidden-product-content").hide();
		$("#show-product-content").show();
	});
});
function doStuff(event, yourchoice)
{
	v.lock();
	$.ajax({
		url: "/product/vote",
		type: "POST",
	    data: {"id":$("#product_id").val(),"vote-value":yourchoice},
	    success: function(data){
	    }
	}); 
}
//-->
</script>
<!--<div id="fb-root"></div>-->
<script>
//Share tweeter
!function(d,s,id){
	var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';
	if(!d.getElementById(id)){
		js=d.createElement(s);
		js.id=id;js.src=p+'://platform.twitter.com/widgets.js';
		fjs.parentNode.insertBefore(js,fjs);
		}
	}(document, 'script', 'twitter-wjs');
</script>